package com.qumitech.visualnovel.controller.rest;

import com.qumitech.visualnovel.model.common.BaseRsp;
import com.qumitech.visualnovel.pubdef.dto.activity.ActivityUserSkillPriceDTO;
import com.qumitech.visualnovel.service.activity.ActivitySkillService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping(value = "/api/activity/skill")
public class ActivitySkillAdminController {
    @Autowired
    private ActivitySkillService activitySkillService;

    @PostMapping("/price/cfg")
    public BaseRsp saveUserSkillPrice(@RequestBody ActivityUserSkillPriceDTO priceDTO){
        return activitySkillService.saveUserSkillPrice(priceDTO);
    }

    @PutMapping("/price/cfg")
    public BaseRsp updateUserSkillPrice(@RequestBody ActivityUserSkillPriceDTO priceDTO){
        return activitySkillService.updateUserSkillPrice(priceDTO);
    }

    @DeleteMapping("/price/cfg/id/{id}")
    public BaseRsp rmUserSkillPrice(@PathVariable("id") long id){
        return activitySkillService.rmUserSkillPrice(id);
    }

    @GetMapping("/price/cfg")
    public BaseRsp listUserSkillPrice(@RequestParam(value = "uid", required = false) Long uid,
                                      @RequestParam(value = "skill_id", required = false) Integer skillId,
                                      @RequestParam(value = "offset") Integer offset,
                                      @RequestParam(value = "limit") Integer limit){
        return activitySkillService.listUserSkillPrice(uid, skillId, offset, limit);
    }
}
